CC=gcc
CUDA_INSTALL_PATH=/usr/local/cuda
CUDA_SDK_PATH=/home/rdilley/NVIDIA_GPU_Computing_SDK/C
#CUDA_SDK_PATH=/Developer/GPU\ Computing/C
NVCC=$(CUDA_INSTALL_PATH)/bin/nvcc

#CFLAGS=-c -Wall -ggdb -I$(CUDA_INSTALL_PATH)/include -DDEBUG
#CFLAGS= -c -ggdb -pg -D_REENTRANT -D_THREAD_SAFE  -I$(CUDA_INSTALL_PATH)/include
CFLAGS= -c -O3 -march=core2 -m64 -D_REENTRANT -D_THREAD_SAFE -DX86_64  -I$(CUDA_INSTALL_PATH)/include
#CUDACFLAGS=-c -pg --host-compilation=c --compiler-options -fno-strict-aliasing -I. -I$(CUDA_INSTALL_PATH)/include -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_INSTALL_PATH)/lib64 -L$(CUDA_INSTALL_PATH)/lib -L$(CUDA_SDK_PATH)/lib -lcuda -lcudart -lcutil
CUDACFLAGS=-c --host-compilation=c --compiler-options -fno-strict-aliasing -I. -I$(CUDA_INSTALL_PATH)/include -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_INSTALL_PATH)/lib64 -L$(CUDA_INSTALL_PATH)/lib -L$(CUDA_SDK_PATH)/lib -lcuda -lcudart -lcutil
#LDFLAGS= -pg -lcuda -lcudart -lc  -L$(CUDA_INSTALL_PATH)/lib64  -L$(CUDA_INSTALL_PATH)/lib -L$(CUDA_SDK_PATH)/lib 
LDFLAGS= -lcuda -lcudart -lc  -L$(CUDA_INSTALL_PATH)/lib64  -L$(CUDA_INSTALL_PATH)/lib -L$(CUDA_SDK_PATH)/lib 
# -lcutil 
#LDFLAGS=-L$(CUDA_INSTALL_PATH)/lib64 -L$(CUDA_INSTALL_PATH)/lib -L$(CUDA_SDK_PATH)/lib -lcuda -lcudart
SOURCES=main.c hash.c util.c file.c md4.c mem.c
CUDASOURCES=gpu_cuda.cu
OBJECTS=$(SOURCES:.c=.o)
CUDAOBJECTS=$(CUDASOURCES:.cu=.ou)
EXECUTABLE=ngale

.SUFFIXES: .cu .ou

all: clean $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) $(CUDAOBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) $(CUDAOBJECTS) -o $@

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.ou : %.cu
	$(NVCC) $(CUDACFLAGS) -c $< -o $@

clean:
	rm -f $(OBJECTS) $(CUDAOBJECTS) $(EXECUTABLE) *~ nigthingale.tar.gz

pkg:
	tar -c  --exclude=*.txt --exclude=*.pot --exclude=*.gz -f - . | gzip -9 > nightingale.tar.gz
